#ifndef HUICCIRCLEPANELNOANI_H
#define HUICCIRCLEPANELNOANI_H

#include <QtWidgets>
#include <QApplication>
#include <QPaintEvent>
#include <QMouseEvent>
#include <QPixmap>
#include <QPainter>
#include <QPoint>
#include <QStyleOption>
#include <math.h>
#include "../include/HGlobalVariable.h"
#define  BG_LEFT_OFFSET      10                       //底图距离左边缘错位10
#define  BG_UP_OFFSET        10                       //底图距离上边缘错位10
#define  BUTTON_PRESS_OFFSET 0                        //old version is 6//press后设计需要的位移
#define  BUTTON_OFFSET  g_nCircelPanelButtonOffset    //单张圆盘之间平移的距离
#define  BUTTON_SIZE    g_nCircelPanelWidth            //单个圆盘区域大小
#define  CENTER_DISK_R  g_nCircelPanelCenterDiskR      //中心按钮作用区域半径
#define  BUTTON_R       g_nCircelPanelCenterR           //按钮中心点距离圆盘中心点距离
#define  BUTTON_DISK_R  g_nCircelPanelButtonDiskR       //圆环按钮作用区域半径

#define  UP_CENTER      QPoint(0 + BUTTON_SIZE/2,BUTTON_SIZE/2 - (BUTTON_R))
#define  UP_CENTER_R    BUTTON_DISK_R

#define  DOWN_CENTER    QPoint(0 + BUTTON_SIZE/2,BUTTON_SIZE/2 + (BUTTON_R))
#define  DOWN_CENTER_R  BUTTON_DISK_R

#define  LEFT_CENTER    QPoint(BUTTON_SIZE/2 - (BUTTON_R),BUTTON_SIZE/2)
#define  LEFT_CENTER_R  BUTTON_DISK_R

#define  RIGHT_CENTER   QPoint(BUTTON_SIZE/2 + (BUTTON_R),BUTTON_SIZE/2)
#define  RIGHT_CENTER_R BUTTON_DISK_R

#define  LEFT_UP_CENTER QPoint(BUTTON_SIZE/2 - BUTTON_R / sqrt(float(2.0)),BUTTON_SIZE/2 - BUTTON_R / sqrt(float(2.0)))
#define  LEFT_UP_R      BUTTON_DISK_R

#define  RIGHT_UP_CENTER QPoint(BUTTON_SIZE/2 + BUTTON_R / sqrt(float(2.0)),BUTTON_SIZE/2 - BUTTON_R / sqrt(float(2.0)))
#define  RIGHT_UP_R     BUTTON_DISK_R

#define  LEFT_DOWN_CENTER QPoint(BUTTON_SIZE/2 - BUTTON_R / sqrt(float(2.0)),BUTTON_SIZE/2 + BUTTON_R / sqrt(float(2.0)))
#define  LEFT_DOWN_R    BUTTON_DISK_R

#define  RIGHT_DOWN_CENTER QPoint(BUTTON_SIZE/2 + BUTTON_R / sqrt(float(2.0)),BUTTON_SIZE/2 + BUTTON_R / sqrt(float(2.0)))
#define  RIGHT_DOWN_R   BUTTON_DISK_R

typedef enum ButtonPosition
{
    BP_INVALID_REGION = 0,
    BP_UP,
    BP_DOWN,
    BP_LEFT,
    BP_RIGHT,
    BP_LEFT_UP,
    BP_RIGHT_UP,
    BP_LEFT_DOWN,
    BP_RIGHT_DOWN,
    BP_CENTER
}ButtonPosition;

typedef enum ButtonType
{
    BTN_UP = 0,
	BTN_DOWN
}ButtonType;

class HUICCirclePanelNoAni : public QWidget
{
    Q_OBJECT

public:
    HUICCirclePanelNoAni(QWidget *parent = 0);
    ~HUICCirclePanelNoAni();

    int           PerssPosition(QPoint);
protected:
    void          paintEvent(QPaintEvent*);
    void          mouseMoveEvent(QMouseEvent *);
    void          mousePressEvent(QMouseEvent *);
    void          mouseReleaseEvent(QMouseEvent *);
private:
    QPixmap       m_pixBackground;

    int           m_nPositionX;
    int           m_nPositionY;
    ButtonPosition m_enumCurrentState;

    QPoint        m_PressCurrent;
    QPoint        m_PressAfter;
    bool          m_bMousePress;

signals:
	void          sigClick(ButtonPosition, ButtonType);
};

#endif // HDISKOPERATORBUTTON_H
